home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / src / mail / pine3.96.tar.gz / pine3.96.tar / pine3.96 / imap / ANSI / c-client / pop3.h < prev    next >
C/C++ Source or Header  |  1994-06-07  |  6KB  |  140 lines

  1. /*
  2.  * Program:    Post Office Protocol 3 (POP3) client routines
  3.  *
  4.  * Author:    Mark Crispin
  5.  *        Networks and Distributed Computing
  6.  *        Computing & Communications
  7.  *        University of Washington
  8.  *        Administration Building, AG-44
  9.  *        Seattle, WA  98195
  10.  *        Internet: MRC@CAC.Washington.EDU
  11.  *
  12.  * Date:    6 June 1994
  13.  * Last Edited:    6 June 1994
  14.  *
  15.  * Copyright 1994 by the University of Washington
  16.  *
  17.  *  Permission to use, copy, modify, and distribute this software and its
  18.  * documentation for any purpose and without fee is hereby granted, provided
  19.  * that the above copyright notices appear in all copies and that both the
  20.  * above copyright notices and this permission notice appear in supporting
  21.  * documentation, and that the name of the University of Washington not be
  22.  * used in advertising or publicity pertaining to distribution of the software
  23.  * without specific, written prior permission.  This software is made
  24.  * available "as is", and
  25.  * THE UNIVERSITY OF WASHINGTON DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED,
  26.  * WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION ALL IMPLIED
  27.  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND IN
  28.  * NO EVENT SHALL THE UNIVERSITY OF WASHINGTON BE LIABLE FOR ANY SPECIAL,
  29.  * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
  30.  * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, TORT
  31.  * (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN
  32.  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  33.  *
  34.  */
  35.  
  36. /* POP3 specific definitions */
  37.  
  38. /* Parameters */
  39.  
  40. #define MAXLOGINTRIALS 3    /* maximum number of login trials */
  41. #define POP3TCPPORT (long) 110    /* assigned TCP contact port */
  42.  
  43.  
  44. /* Command bits from pop3_getflags() */
  45.  
  46. #define fSEEN 1
  47. #define fDELETED 2
  48. #define fFLAGGED 4
  49. #define fANSWERED 8
  50.  
  51.  
  52. /* POP3 I/O stream local data */
  53.     
  54. typedef struct pop3_local {
  55.   TCPSTREAM *tcpstream;        /* TCP I/O stream */
  56.   char *host;            /* server host name */
  57.   char *response;        /* last server reply */
  58.   char *reply;            /* text of last server reply */
  59.   char *buf;            /* temporary buffer */
  60.   unsigned long buflen;        /* current size of temporary buffer */
  61.   char **header;        /* message headers */
  62.   char **body;            /* message bodies */
  63. } POP3LOCAL;
  64.  
  65.  
  66. /* Convenient access to local data */
  67.  
  68. #define LOCAL ((POP3LOCAL *) stream->local)
  69.  
  70. /* Function prototypes */
  71.  
  72. DRIVER *pop3_valid (char *name);
  73. void *pop3_parameters (long function,void *value);
  74. void pop3_find (MAILSTREAM *stream,char *pat);
  75. void pop3_find_bboards (MAILSTREAM *stream,char *pat);
  76. void pop3_find_all (MAILSTREAM *stream,char *pat);
  77. void pop3_find_all_bboards (MAILSTREAM *stream,char *pat);
  78. long pop3_subscribe (MAILSTREAM *stream,char *mailbox);
  79. long pop3_unsubscribe (MAILSTREAM *stream,char *mailbox);
  80. long pop3_subscribe_bboard (MAILSTREAM *stream,char *mailbox);
  81. long pop3_unsubscribe_bboard (MAILSTREAM *stream,char *mailbox);
  82. long pop3_create (MAILSTREAM *stream,char *mailbox);
  83. long pop3_delete (MAILSTREAM *stream,char *mailbox);
  84. long pop3_rename (MAILSTREAM *stream,char *old,char *new);
  85. MAILSTREAM *pop3_open (MAILSTREAM *stream);
  86. void pop3_close (MAILSTREAM *stream);
  87. void pop3_fetchfast (MAILSTREAM *stream,char *sequence);
  88. void pop3_fetchflags (MAILSTREAM *stream,char *sequence);
  89. ENVELOPE *pop3_fetchstructure (MAILSTREAM *stream,long msgno,BODY **body);
  90. char *pop3_fetchheader (MAILSTREAM *stream,long msgno);
  91. char *pop3_fetchtext (MAILSTREAM *stream,long msgno);
  92. char *pop3_fetchtext_work (MAILSTREAM *stream,long msgno);
  93. char *pop3_fetchbody (MAILSTREAM *stream,long m,char *s,unsigned long *len);
  94. void pop3_setflag (MAILSTREAM *stream,char *sequence,char *flag);
  95. void pop3_clearflag (MAILSTREAM *stream,char *sequence,char *flag);
  96. void pop3_search (MAILSTREAM *stream,char *criteria);
  97. long pop3_ping (MAILSTREAM *stream);
  98. void pop3_check (MAILSTREAM *stream);
  99. void pop3_expunge (MAILSTREAM *stream);
  100. long pop3_copy (MAILSTREAM *stream,char *sequence,char *mailbox);
  101. long pop3_move (MAILSTREAM *stream,char *sequence,char *mailbox);
  102. long pop3_append (MAILSTREAM *stream,char *mailbox,char *flags,char *date,
  103.           STRING *message);
  104. void pop3_gc (MAILSTREAM *stream,long gcflags);
  105.  
  106. long pop3_send_num (MAILSTREAM *stream,char *command,unsigned long n);
  107. long pop3_send (MAILSTREAM *stream,char *command,char *args);
  108. long pop3_reply (MAILSTREAM *stream);
  109. long pop3_fake (MAILSTREAM *stream,char *text);
  110. short pop3_getflags (MAILSTREAM *stream,char *flag);
  111. char pop3_search_all (MAILSTREAM *stream,long msgno,char *d,long n);
  112. char pop3_search_answered (MAILSTREAM *stream,long msgno,char *d,long n);
  113. char pop3_search_deleted (MAILSTREAM *stream,long msgno,char *d,long n);
  114. char pop3_search_flagged (MAILSTREAM *stream,long msgno,char *d,long n);
  115. char pop3_search_keyword (MAILSTREAM *stream,long msgno,char *d,long n);
  116. char pop3_search_new (MAILSTREAM *stream,long msgno,char *d,long n);
  117. char pop3_search_old (MAILSTREAM *stream,long msgno,char *d,long n);
  118. char pop3_search_recent (MAILSTREAM *stream,long msgno,char *d,long n);
  119. char pop3_search_seen (MAILSTREAM *stream,long msgno,char *d,long n);
  120. char pop3_search_unanswered (MAILSTREAM *stream,long msgno,char *d,long n);
  121. char pop3_search_undeleted (MAILSTREAM *stream,long msgno,char *d,long n);
  122. char pop3_search_unflagged (MAILSTREAM *stream,long msgno,char *d,long n);
  123. char pop3_search_unkeyword (MAILSTREAM *stream,long msgno,char *d,long n);
  124. char pop3_search_unseen (MAILSTREAM *stream,long msgno,char *d,long n);
  125. char pop3_search_before (MAILSTREAM *stream,long msgno,char *d,long n);
  126. char pop3_search_on (MAILSTREAM *stream,long msgno,char *d,long n);
  127. char pop3_search_since (MAILSTREAM *stream,long msgno,char *d,long n);
  128. unsigned long pop3_msgdate (MAILSTREAM *stream,long msgno);
  129. char pop3_search_body (MAILSTREAM *stream,long msgno,char *d,long n);
  130. char pop3_search_subject (MAILSTREAM *stream,long msgno,char *d,long n);
  131. char pop3_search_text (MAILSTREAM *stream,long msgno,char *d,long n);
  132. char pop3_search_bcc (MAILSTREAM *stream,long msgno,char *d,long n);
  133. char pop3_search_cc (MAILSTREAM *stream,long msgno,char *d,long n);
  134. char pop3_search_from (MAILSTREAM *stream,long msgno,char *d,long n);
  135. char pop3_search_to (MAILSTREAM *stream,long msgno,char *d,long n);
  136. typedef char (*search_t) (MAILSTREAM *stream,long msgno,char *d,long n);
  137. search_t pop3_search_date (search_t f,long *n);
  138. search_t pop3_search_flag (search_t f,char **d);
  139. search_t pop3_search_string (search_t f,char **d,long *n);
  140.